<?php

use yii\helpers\Html;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model common\models\Shicai */

$this->title = $model['title'].'-'.Yii::$app->params['brand'];
$title = $model['title'];
$this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Shicais'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $title;
?>
<div class="note-index row">
    <div class="col-md-8 br10 white">
        <h1><small><?= Html::encode($model['title']) ?></small></h1>
        <div class="info">
            <!--<span class="attr" title="作者"><i class="iconfont">&#xe630;</i><?//= $model['author']; ?></span>-->
            <span class="attr" title="日期"><i class="iconfont">&#xe6f0;</i><?= date('Y-m-d H:i:s', $model['created_at']); ?></span>
            <span class="attr" title="浏览量"><i class="iconfont">&#xe6a4;</i><?= $model['view']; ?></span>
            <!--<span title="标签"><i class="iconfont">&#xe60d;</i><?//= Html::a($model['tag'], Url::to('/topic/' . $model['tag']), ['title' => $model['tag']]); ?></span>-->
        </div>
        <hr>
        <blockquote class="description"><small><?= $model['desc']; ?></small></blockquote>
        <div class="content">
            <?php if (!empty($model['img'])): ?>
                <p><img src="<?= Yii::$app->params['img_domain'] . $model['img']; ?>" alt="<?= $model['title']; ?>" /></p>
            <?php else: ?>
                <p><img src="<?= Yii::$app->params['frontend_domain'] ?>/img/default.jpg" alt="<?= $model['title']; ?>" /></p>
            <?php endif; ?>
            <?= $model['content']; ?>
        </div>
        <hr>
        <div class="relate_city">
            <p>下一篇：<span><?= !empty($next) ? Html::a($next['title'], Url::to('/shicai/' . $next['id'])) : '没有了'; ?></span></p>
            <p>上一篇：<span><?= !empty($last) ? Html::a($last['title'], Url::to('/shicai/' . $last['id'])) : '没有了'; ?></span></p>
        </div>
    </div>
    <div class="col-md-4 br10 white">
        <div class="row widget">
            <div class="col-md-12">
                <h2 class="widget_title"><small><i class="iconfont">&#xe639;</i>相关文章</small></h2>
                <hr>
                <?php
                foreach ($relate as $value) {
                    echo '<p class="article"><i class="iconfont fs20">&#xe89d;</i>';
                    echo Html::a($value['title'], Url::to('/shicai/' . $value['id']));
                    echo '</p>';
                }
                ?>
            </div>
        </div>
        <div class="row widget">
            <div class="col-md-12">
                <h2 class="widget_title"><small><i class="iconfont">&#xe60d;</i>相關食材</small></h2>
                <hr>
                <?php
                foreach ($tag as $value) {
                    echo '<span class="widget-tag">';
                    echo Html::a($value['title'], Url::to('/sltopic/' . $value['id']), ['title' => $value['title'], 'class' => 'btn btn-default', 'role' => 'button']);
                    echo '</span>';
                }
                ?>
            </div>
        </div>    
    </div>
</div>
